from django.db import models

#导入时间域
from django.utils import timezone

#基类
class Base(models.Model):

	#创建时间
	create_time = models.DateTimeField(default=timezone.now,null=True)

	class Meta:
		abstract = True

#用户类
class User(Base):

	id = models.AutoField(primary_key=True)
	username = models.CharField(max_length=100,unique=True)
	password = models.CharField(max_length=200)
	num = models.IntegerField(null=True)
	phone=models.IntegerField(null=True)
	photos=models.CharField(max_length=1000)

	class Meta:
		db_table = "user"


#课程表
class Course(Base):
	title=models.CharField(max_length=100)
	desc=models.CharField(max_length=200)
	price=models.IntegerField()
	cid=models.IntegerField()
	video=models.CharField(max_length=200)

	class Meta:
		db_table='course'

# 课程关注
class Flow(models.Model):
	uid=models.IntegerField()
	course_id=models.IntegerField()

	class Meta:
		db_table='flow'

